package com.whiteape.book.ui.adapter.holder;

import android.widget.ImageView;
import android.widget.TextView;

import com.whiteape.book.R;

import com.bumptech.glide.Glide;
import com.whiteape.book.model.zssq.BookSortBean;
import com.whiteape.book.ui.base.adapter.ViewHolderImpl;


public class BookSortHolder extends ViewHolderImpl<BookSortBean> {

    private TextView mTvType;
    private TextView mTvCount;
    private ImageView mIvCover;

    @Override
    public void initView() {
        mTvType = findById(R.id.sort_tv_type);
        mTvCount = findById(R.id.sort_tv_count);
        mIvCover = findById(R.id.sort_iv_cover);
    }

    @Override
    public void onBind(BookSortBean value, int pos) {
        mTvType.setText(value.getName());
        mTvCount.setText(getContext().getResources().getString(R.string.wa_sort_book_count,value.getBookCount()));
        Glide.with(getContext())
                .load("https://statics.zhuishushenqi.com" + value.getBookCover().get(0))
                .into(mIvCover);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_sort;
    }
}
